|
|
|
|
|
|
|
The learning curve to understanding and creating robust classes is not small. Most of us have had the procedural method of development ingrained in us since we first started programming. Do not underestimate the time its going to take to modify your current way of thinking. Its very easy to create classes, but its not so easy to create truly robust, reusable classes. In addition, the design process for OOP is much different than the procedural, top-down design that you may have learned. Of course, if youre brand new to programming, this type of programming method might actually come to you a lot easier. |
|
|
|
|
|
|
|
|
Unfortunately, the performance of some object-based programming languages suffer somewhat. With Visual Basic, you may find a 10 to 20% speed reduction when using objects as opposed to functions. However, with a little bit of optimization, such as using With...End With, and caching properties in local variables, most of this performance hit can be reduced. With todays faster computers, this is not as much of an issue as it once was. |
|
|
|
|
|
|
|
|
Not Everything Is an Object |
|
|
|
|
|
|
|
|
The biggest mistake most developers make when learning OOP is to try to make everything a class. Not every task fits well in the object-oriented paradigm. Youll still write a lot of code thats not object oriented. You need to be able to identify those tasks that are appropriate to encapsulate as objects and those that are not. |
|
|
|
|
|
|
|
|
For example, if you have some functions that perform string manipulation, and these functions do not rely on any global variables, just leave them as functions. You need to look at a function to see whether it just uses parameters passed to it and simply returns one value. If so, its probably best to leave this as a simple function than to create a class. |
|
|
|
 |
|
|
|
|
TIP Dont try to make everything in your application an object. |
|
|
|
|
|